<?php

defined('_JEXEC') or die("Restricted access");

class ConsoleModelSetting extends JModelAdmin {
    
    public function getTable($name = 'Setting', $prefix = 'ConsoleTable', $config = array()) {
        return JTable::getInstance($name, $prefix, $config);
    }
    
    public function getForm($data = array(), $loadData = true) {
        $form = $this->loadForm(
            'com_console.setting',
            'setting',
            array(
                'control'=>'jform',
                'load_data'=>$loadData
            )
        );
        
        if (empty($form)) {
            return false;
        }
        
        return $form;
    }
    
    protected function loadFormData() {
        $data = JFactory::getApplication()->getUserState(
            'com_console.edit.setting.data',
            array()
        );
        
        if (empty($data)) {
            $data = $this->getItem();
        }
        
        return $data;
    }
}
